﻿#include "maindesigner.h"
#include "ui_maindesigner.h"

MainDesigner::MainDesigner(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::MainDesigner)
{
    ui->setupUi(this);

}

MainDesigner::~MainDesigner()
{
    delete ui;
}

void MainDesigner::slots_DisplayLog(QString txt, QColor color)
{
    qDebug() << txt;
    QDateTime currentDataTime = QDateTime::currentDateTime();
    QString dataTime = currentDataTime.toString("MM-dd hh:mm:ss::zz");
    QString str_color = QString("<font color="+color.name()+">");
    if( ui->txt_log->toPlainText().size() > 1024*10 ) {
        ui->txt_log->clear();
    }
    ui->txt_log->moveCursor(QTextCursor::End,QTextCursor::MoveAnchor);
    ui->txt_log->append(str_color+dataTime+txt);
    ui->txt_log->moveCursor(QTextCursor::End);
}

void MainDesigner::on_pushButton_clicked()
{
    emit sig_SerialWrite("hello world");

}

